<?php

namespace App\Http\Requests\Api;

use App\Common\ValidationInfo;
use Illuminate\Foundation\Http\FormRequest;

class UserRegisterRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            //
            'account' => 'required|alpha_num|between:2,30|unique:users,account',
            'name'    => 'required|string|between:2,20',
            'email'    => 'required|email|unique:users,email',
            'password' => 'required|alpha_num|confirmed|between:4,15',
        ];
    }

    public function messages()
    {
        //return parent::messages(); // TODO: Change the autogenerated stub
        return ValidationInfo::messages();
    }

    public function attributes()
    {
        //return parent::attributes(); // TODO: Change the autogenerated stub
        return [
            'account' => '账号',
            'name'    => '昵称',
            'email'   => '邮箱',
            'password' => '密码'
        ];
    }
}
